package com.bw.finance.controller;


import com.alipay.api.domain.PageInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bw.finance.conf.ResponseResult;
import com.bw.finance.eneity.invest.BiaoInfo;
import com.bw.finance.eneity.user.EbankInvestor;
import com.bw.finance.service.IEbankInvestLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lizhengqian
 * @since 2020-08-25
 */
@RestController
@RequestMapping("/investlog")
public class EbankInvestLogController {

    @Autowired
    private IEbankInvestLogService investLogService;

    @PostMapping("/touzi/{uid}/{balance}/{money}")
    public ResponseResult touzi(@PathVariable Long uid, @PathVariable BigDecimal balance, @PathVariable BigDecimal money,@RequestBody BiaoInfo biaoInfo){
        ResponseResult result = ResponseResult.SUCCESS();
        try {
            result=investLogService.touzi(uid,balance,money,biaoInfo);
        }catch (Exception e){
            result.setSuccess(false);
            result.setMessage("投资失败");
        }
        return result;
    }


    @PostMapping("/getTouziLog/{id}")
    public ResponseResult getTouziLog(@PathVariable Long id){
        ResponseResult result = ResponseResult.SUCCESS();
        try {
            result = investLogService.getTouziList(id);
        }catch (Exception e){
            result.setSuccess(false);
            result.setMessage("投资失败");
        }
        return result;
    }
}
